<cfoutput>
	#startFormTag(
		id="updateForm", 
		class="form-horizontal", 
		method="post", 
		route="#PARAMS.routeType#", 
		model="#PARAMS.model#", 
		subModel="#PARAMS.subModel#", 
		key="#PARAMS.key#"
	)#
</cfoutput>
		<fieldset>
			<!--- New Item --->
			<cfif IsStruct(item.model)>
				<cfoutput>
					<cfloop list="#item.columns.list#" index="column">
						<div class="control-group">
							<label class="control-label" for="#column#">#Humanize(Replace(column, "_", " ", "All"))#:</label>
							<div class="controls">
								<cfif column CONTAINS "phone_number">
									#dspPhoneNumber(value="#item.model[column]#")#
								<cfelseif column CONTAINS "sex">
									<label class="radio" style="margin-left:5px;">
										<input id="#column#-M" class="validate[required]" type="radio" value="M" name="#PARAMS.model#[#column#]">M
									</label>
									<label class="radio" style="margin-left:5px;">
										<input id="#column#-F" class="validate[required]" type="radio" value="F" name="#PARAMS.model#[#column#]">F
									</label>
								<cfelse>
									<input 	type="text" id="#column#" name="#PARAMS.model#[#column#]" class="input-xlarge #item.columns[column].validate#"
											value="#item.model[column]#" maxlength="#item.columns[column].maxlength#">
								</cfif>
							</div>
						</div>
					</cfloop>

					<!--- Multiple Selects --->
					<cfif ListFindNoCase("parent,employee", PARAMS.model)>
						<div class="control-group" align="center" style="width:75%;height:1px;background-color:##808080;margin:18px auto;"></div>

						<div class="control-group">
							<label class="control-label" for="#column#">Studens:</label>
							<div class="controls" style="margin-top:5px; margin-left: 165px;">
								#dspStudentSelect(title = "Students")#
								<input type="hidden" id="itemList" name="#PARAMS.model##pluralize(PARAMS.subModel)#[#PARAMS.subModel#_id]", value="0" />
							</div>
						</div>
					<cfelseif PARAMS.model IS "student">
						<cfloop from="1" to="5" index="intGoal">
							<div class="control-group">
								<label class="control-label" for="#column#-#intGoal#">Goal ###intGoal#:</label>
								<div class="controls" style="margin-top:5px; margin-left: 165px;">
									<input id="#column#-#intGoal#" class="input-xlarge" type="text" name="goal[goal][#intGoal#]" />
								</div>
							</div>
						</cfloop>
					</cfif>
				</cfoutput>
			<cfelse>
				<!--- Existing Item --->
				<cfoutput query="item.model" group="id">
					<cfloop list="#item.columns.list#" index="column">
						<div class="control-group">
							<label class="control-label" for="#column#">#Humanize(Replace(column, "_", " ", "All"))#:</label>
							<div class="controls">
								<cfif column CONTAINS "phone_number">
									#dspPhoneNumber(value="#item.model[column][currentRow]#")#
								<cfelseif column CONTAINS "sex">
									<label class="radio" style="margin-left:5px;">
										<cfset checked = (item.model[column][currentRow] IS "M") ? 'checked="true" ' : "">
										<input id="#column#-M" class="validate[required]"#checked# type="radio" value="M" name="#PARAMS.model#[#column#]">M
									</label>
									<label class="radio" style="margin-left:5px;">
										<cfset checked = (item.model[column][currentRow] IS "F") ? 'checked="true" ' : "">
										<input id="#column#-F" class="validate[required]"#checked# type="radio" value="F" name="#PARAMS.model#[#column#]">F
									</label>
								<cfelse>
									<input 	type="text" id="#column#" name="#PARAMS.model#[#column#]" class="input-xlarge #item.columns[column].validate#"
											value="#item.model[column][currentRow]#" maxlength="#item.columns[column].maxlength#">
								</cfif>
							</div>
						</div>
					</cfloop>

					<!--- Multiple Selects --->
					<cfif ListFindNoCase("parent,employee", PARAMS.model)>
						<div class="control-group" align="center" style="width:75%;height:1px;background-color:##808080;margin:18px auto;"></div>

						<div class="control-group">
							<label class="control-label" for="#column#">Students:</label>
							<div class="controls" style="margin-top:5px; margin-left: 165px;">
								#dspStudentSelect(
									name = "#PARAMS.model#[student_id]",
									value = "#ValueList(item.model.student_id)#",
									title = "Students"
								)#
								<input 	type="hidden" id="itemList" name="#PARAMS.model##pluralize(PARAMS.subModel)#[#PARAMS.subModel#_id]"
										value="#ValueList(item.model.student_id)#" />
							</div>
						</div>
					<cfelseif PARAMS.model IS "student">
						<cfset intGoal = 0>
						<cfoutput>
							<cfset intGoal += 1>
							<div class="control-group">
								<label class="control-label" for="#column#-#intGoal#">Goal ###intGoal#:</label>
								<div class="controls" style="margin-top:5px; margin-left: 165px;">
									<input 	id="#column#-#intGoal#" class="input-xlarge" type="text" name="goal[goal][#item.model.goalID#]"
											value="#item.model.goal#" />
								</div>
							</div>
						</cfoutput>
					</cfif>
				</cfoutput>
			</cfif>
		</fieldset>
<cfoutput>
	#endFormTag()#
</cfoutput>

<script type="text/javascript">	
	$('#items').multiselect({
		"header": false,
		"noneSelectedText": "Please Select " + $('#items').attr("label"),
		"selectedText": "# " + $('#items').attr("label"),
		"selectedList": 3,
		"minWidth": 280
	});
</script>


